package com.lagou.edu.controller;

import com.lagou.edu.service.AuthCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@RefreshScope
@RequestMapping({"/code", ""})
public class LagouServiceCodeController {

    @Autowired
    private AuthCodeService service;

    @GetMapping("/create/{email}")
    public boolean createCode(@PathVariable("email") String email) {
        return service.createCode(email);
    }

    @GetMapping("validate/{email}/{code}")
    public int validate(@PathVariable("email") String email, @PathVariable("code") String code) {
        return service.validate(email,code);
    }
}
